<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>文章添加页</title>
    <script src="jquery-1.9.1.min.js"></script>
    <script>
        function mysub(type) {
            var title = jQuery("#title");
            var content = jQuery("#content");
            if (type == 2) {
                if (confirm("确认取消？")) {
                    title.val("");
                    content.val("");
                    location.href = "myart.html";
                }
                return false;
            }
            jQuery.getJSON("addart", {
                "title": title.val(),//此时要拿到值
                "content": content.val()
            }, function (data) {
                if (data != null && data.succ == 1) {
                    alert("添加成功！");
                    if (confirm("是否继续添加？")) {
                        location.href = location.href;
                    } else {
                        location.href = "myart.html";
                    }
                } else {
                    alert("添加失败" + data.msg);
                }
            });
        }
    </script>
</head>
<body style="background-image: url(b3.jpg);background-repeat: no-repeat;background-size: 100% auto">
<!--<body style="background: gainsboro">-->
<div style="text-align: center;margin-top: 50px">
    <h1>我的文章编辑</h1>
    标题：<input id="title" type="text">
    <p></p>
    正文：<textarea id="content" style="width: 60%;height: 300px;"></textarea>
    <p></p>
    <!--<textarea>:多行的文本输入控件-->
    <input value="提 交" type="button" onclick="mysub(1)">
    <input value="取 消" type="button" onclick="mysub(2)">
</div>
</body>
</html>